home *** CD-ROM | disk | FTP | other *** search
- package com.ms.directX;
-
- import com.ms.com.IUnknown;
-
- public class dSoundBuffer implements IdSoundBuffer {
- private byte[] getBuff(WaveFormatEx var1) {
- byte[] var2 = new byte[var1.cbSize + 18];
- this.setValInBuff(var2, 0, 2, var1.wFormatTag);
- this.setValInBuff(var2, 2, 2, var1.nChannels);
- this.setValInBuff(var2, 4, 4, var1.nSamplesPerSec);
- this.setValInBuff(var2, 8, 4, var1.nAvgBytesPerSec);
- this.setValInBuff(var2, 12, 2, var1.nBlockAlign);
- this.setValInBuff(var2, 14, 2, var1.wBitsPerSample);
- this.setValInBuff(var2, 16, 2, var1.cbSize);
-
- for(int var3 = 0; var3 < var1.cbSize; ++var3) {
- var2[18 + var3] = var1.extra[var3];
- }
-
- return var2;
- }
-
- public native void Stop();
-
- public native void InternalSetObject(IUnknown var1);
-
- public native IUnknown InternalGetObject();
-
- public native void SetCurrentPosition(int var1);
-
- public native int GetPan();
-
- public native void SetPan(int var1);
-
- public native void GetCurrentPosition(DSCursors var1);
-
- public native int GetVolume();
-
- public native void SetVolume(int var1);
-
- private void setValInBuff(byte[] var1, int var2, int var3, int var4) {
- var1[var2] = (byte)(var4 & 255);
- var1[var2 + 1] = (byte)(var4 >> 8 & 255);
- if (var3 > 2) {
- var1[var2 + 2] = (byte)(var4 >> 16 & 255);
- var1[var2 + 3] = (byte)(var4 >> 24 & 255);
- }
-
- }
-
- private int getValFromBuff(byte[] var1, int var2, int var3) {
- int var4 = 0;
- var4 = var1[var2] + var1[var2 + 1] * 256;
- if (var3 > 2) {
- var4 += var1[var2 + 2] + var1[var2 + 3] * 256 << 16;
- }
-
- return var4;
- }
-
- public native void Initialize(dSound var1, DSBufferDesc var2, byte[] var3);
-
- public void Initialize(dSound var1, DSBufferDesc var2, WaveFormatEx var3) {
- byte[] var4 = this.getBuff(var3);
- this.Initialize(var1, var2, var4);
- }
-
- public native void WriteBuffer(int var1, int var2, byte[] var3, int var4);
-
- public native void Restore();
-
- public native void GetCaps(DSBCaps var1);
-
- public native int GetFormatSize();
-
- public native void GetFormat(byte[] var1, int var2);
-
- public native int GetFrequency();
-
- public native void SetFormat(byte[] var1);
-
- public void SetFormat(WaveFormatEx var1) {
- byte[] var2 = this.getBuff(var1);
- this.SetFormat(var2);
- }
-
- public native void Play(int var1, int var2, int var3);
-
- public WaveFormatEx GetFormat() {
- int var1 = this.GetFormatSize();
- byte[] var2 = new byte[var1];
- this.GetFormat(var2, var1);
- WaveFormatEx var3 = new WaveFormatEx();
- var3.wFormatTag = this.getValFromBuff(var2, 0, 2);
- var3.nChannels = this.getValFromBuff(var2, 2, 2);
- var3.nSamplesPerSec = this.getValFromBuff(var2, 4, 4);
- var3.nAvgBytesPerSec = this.getValFromBuff(var2, 8, 4);
- var3.nBlockAlign = this.getValFromBuff(var2, 12, 2);
- var3.wBitsPerSample = this.getValFromBuff(var2, 14, 2);
- var3.cbSize = this.getValFromBuff(var2, 16, 2);
- var3.extra = new byte[var3.cbSize];
-
- for(int var4 = 0; var4 < var3.cbSize; ++var4) {
- var3.extra[var4] = var2[var4 + 18];
- }
-
- return var3;
- }
-
- public native int GetStatus();
-
- public native void TransferToSoundBuffer(DSResourceDesc var1, int var2);
-
- public native void SetFrequency(int var1);
- }
-